<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">

<head th:include="include :: header"></head>

<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            开发者微信号：<input type="text" name="toUserName"/>
                        </li>



                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="wx:userMsg:add">-->
                <!--<i class="fa fa-plus"></i> 添加-->
            <!--</a>-->
            <!--<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()"-->
               <!--shiro:hasPermission="wx:userMsg:edit">-->
                <!--<i class="fa fa-edit"></i> 修改-->
            <!--</a>-->
            <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="wx:userMsg:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="wx:userMsg:export">
                <i class="fa fa-download"></i> 导出
            </a>
            <a class="btn btn-warning" onclick="replyMsg()" shiro:hasPermission="wx:userMsg:export">
                <i class="fa fa-download"></i> 回复消息
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>

        </div>
    </div>
</div>
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" style="display: none;">
    <div class="slides" style="width: 40896px;"></div>
    <h3 class="title">微信图片</h3>
    <a class="prev">&lt;</a>
    <a class="next">&gt;</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('wx:userMsg:edit')}]];
    var removeFlag = [[${@permission.hasPermi('wx:userMsg:remove')}]];
    var prefix = ctx + "wx/userMsg";
    // 获取数据字典数据
    var datas = [[${@dict.getType('wx_user_msg')}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "消息管理",
            showExport: true,
            columns: [{
                radio: true
            },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'nickname',
                    title: '昵称',
                    visible: true
                },
                {
                    field: 'headimgurl',
                    title: '头像',
                    visible: true,
                    formatter:function(value,row,index){
                        var imgs=[];
                        imgs.push('<img src="'+value+'" style="width:80px;height:80px;"/>')
                        return imgs.join("");
                    }
                },
                {
                    field: 'toUserName',
                    title: '开发者微信号',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'fromUserName',
                    title: '发送方帐号（一个OpenID）',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'picUrl',
                    title: '图片',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if(value!=''&&value!=null){
                            var actions = [];
                            actions.push('<div class="lightBoxGallery">');
                            actions.push('<a href="'+value+'" title="微信图片" data-gallery=""><img style="width:90px;height:90px;" src="'+value+'">');
                            actions.push('</div>');
                            return actions.join('');
                        }
                        return "";
                    }
                },
                {
                    field: 'content',
                    title: '消息内容',
                    sortable: true
                },
                {
                    field: 'msgType',
                    title: '消息类型',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'msgId',
                    title: '消息id，64位整型',
                    sortable: true,
                    visible: false
                },

                {
                    field: 'mediaId',
                    title: '图片消息媒体id，可以调用获取临时素材接口拉取数据。',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'format',
                    title: '语音格式，如amr，speex等',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'thumbMediaid',
                    title: '视频消息缩略图的媒体id，可以调用多媒体文件下载接口拉取数据。',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'locationX',
                    title: '地理位置维度',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'locationY',
                    title: '地理位置经度',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'scale',
                    title: '地图缩放大小',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'label',
                    title: '地理位置信息',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'title',
                    title: '消息标题',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'description',
                    title: '消息描述',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'url',
                    title: '消息链接',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'createTime',
                    title: '接收时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


</script>
</body>
</html>